package cn.edu.ctbu.sbadmin.school.dao;

import cn.edu.ctbu.sbadmin.common.core.MyMapper;
import cn.edu.ctbu.sbadmin.common.domain.MQueryParam;
import cn.edu.ctbu.sbadmin.common.domain.QueryPagePara;
import cn.edu.ctbu.sbadmin.school.domain.DimClassDO;
import cn.edu.ctbu.sbadmin.school.domain.LabLogInfo;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;


/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 关注公众号：MarkerHub
 * @since 2021-06-17
 */

public interface LabLogInfoMapper extends MyMapper<LabLogInfo> {

    @Select("SELECT\n" +
            "lab_log_info.id,\n" +
            "lab_log_info.class_id,\n" +
            "lab_log_info.lab_id,\n" +
            "lab_log_info.project_name,\n" +
            "lab_log_info.section_from,\n" +
            "lab_log_info.section_to,\n" +
            "lab_log_info.content,\n" +
            "lab_log_info.`week`,\n" +
            "lab_log_info.day_of_week,\n" +
            "lab_log_info.course_time,\n" +
            "lab_log_info.request_type,\n" +
            "lab_log_info.lab_type,\n" +
            "lab_log_info.create_time,\n" +
            "dim_class.class_name\n" +
            "FROM\n" +
            "lab_log_info\n" +
            "LEFT JOIN dim_class ON lab_log_info.class_id = dim_class.id\n"+
            "${ew.customSqlSegment}"
    )
    IPage<LabLogInfo> selectPage(IPage<LabLogInfo> page, @Param(Constants.WRAPPER) QueryWrapper<LabLogInfo> queryWrapper);
    /**
     * 查询视图
     * @param mQuery
     * @return
     */
    public List<LabLogInfo> listView(MQueryParam mQuery);

    /**
     * 查询计数
     * @param mQuery
     * @return
     */
    public int  countView(MQueryParam mQuery);
}
